<template>
	<view class="box">
		<view class="container">
			<!-- 日期 -->
			<view class="date flex-between">
				<view class="li" v-for="(item, index) in date" :key="index" :class="[index == curIndex ? 'li-c' : '']">{{item}}</view>
			</view>
			<!-- 面板 -->
			<view class="panel">
				<view class="sales flex-between">
					<view class="lef">
						销售额
						<view class="price">￥88888.00</view>
					</view>
					<view class="rig tc">切换订单</view>
				</view>
				<view class="ul">
					<view class="li flex-between">
						<view class="lef" v-for="(item, index) in panel.top" :key="index">
							{{item.label}}
							<view class="price">￥{{item.value}}</view>
						</view>
					</view>
					<view class="li bom flex-between">
						<view class="rig" v-for="(item, index) in panel.bom" :key="index">
							{{item.label}}
							<view class="price">￥{{item.value}}</view>
						</view>
					</view>
				</view>
			</view>
			<!-- 切换 -->
			<view class="filter flex-between" :class="{ceil : isShowSearch}">
				<!-- 	<Filter @open="tbShow = true" @close="close" @filter="filter" type="taobao"></Filter>
				<Filter @open="timeShow = true" @close="close" @filter="filter" type="time"></Filter>
				<Filter @open="orderShow = true" @close="close" @filter="filter" type="order"></Filter> -->
				<!-- <Filter @open="filterShow = true" @close="close" :show="filterShow"></Filter> -->
				<view class="flex-between" @click="toPath('position')">阿里妈妈<image src="../../static/index/down.png" class="icon"></image>
				</view>
				<view class="flex-between" @click="toPath('position')">创建时间<image src="../../static/index/down.png" class="icon"></image>
				</view>
				<view class="flex-between" @click="toPath('position')">订单状态<image src="../../static/index/down.png" class="icon"></image>
				</view>

				<view class="flex-between" @click="toPath('position')">推广位<image src="../../static/index/down.png" class="icon"></image>
				</view>
			</view>
		</view>
		<!-- 列表 -->
		<view class="list">
			<view class="item" v-for="(item,index) in 6" :key="index">
				<view class="top flex-between">
					<image src="../../static/login/wechat-code.png"></image>
					<view class="rig">
						<view class="title">牛肉牛肉片片牛肉片牛肉片牛肉片</view>
						<view class="time flex-between">
							<text>订单付款</text>
							<view class="tiem-rig">2020-02-03 21:00:32付款</view>
						</view>
					</view>
				</view>
				<view class="cen flex-between">
					<view class="li">
						付款金额
						<view>￥9.96</view>
					</view>
					<view class="li">
						提成比
						<view>￥9.96</view>
					</view>
					<view class="li">
						预估收入
						<view>￥9.96</view>
					</view>
					<view class="li">
						下单时长
						<view>￥9.96</view>
					</view>
				</view>
				<view class="bom flex-between">
					<view class="user flex-between">
						<image src="../../static/login/wechat-code.png"></image>
						晚风涟漪
					</view>
					<text class="name">运营人：暮宸1</text>
				</view>
			</view>
		</view>
		<view class="auth" @click="toPath('login')">
			<view class="btn">授权登录</view>
		</view>
	</view>
</template>

<script>
	import {
		dateFormat
	} from '../../utils'
	export default {
		data() {
			return {
				date: ['今天', '昨天', '最近七天', '最近30天', '本月'],
				panel: {
					top: [{
						label: '全部佣金',
						value: '123.00'
					}, {
						label: '付款佣金',
						value: '123.00'
					}],
					bom: [{
						label: '结算佣金',
						value: '123.00'
					}, {
						label: '失效佣金',
						value: '123.00'
					}]
				},
				isShowSearch: false, //吸顶
				timeShow: false,
				orderShow: false,
				tbShow: false,
				curIndex: 0,
				params: {
					page: 1,
					size: 10,
					order: '',
					sort: '',
					startTime: '',
					endTime: '',
					timeType: 0,
					taobaoId: '',
					positionId: '',
					staffId: '',
					tkStatus: ''
				}
			};
		},
		onLoad() {
			// 初始化时间
			this.getTime()
		},
		// 上拉加载
		onReachBottom() {
			console.log('上拉加载')
		},
		// 下拉刷新
		onPullDownRefresh() {
			console.log('下拉刷新')
		},
		onPageScroll(e) {
			console.log(e.scrollTop)
			if (e.scrollTop > 260) {
				this.isShowSearch = true;
			} else {
				this.isShowSearch = false;
			}
		},

		methods: {
			// 获取数据
			getData() {
				this.$service.order.orderStatistics(this.params).then((res) => {

				}).catch((err) => {

				})
			},
			toPath(val) {
				uni.navigateTo({
					url: '/pages/common/login'
				})
			},
			filter() {

			},
			// 选择时间
			pickDate() {

			},
			// 关闭弹窗
			close(val) {
				switch (val) {
					case 'time':
						this.timeShow = false
						break;
					case 'order':
						this.orderShow = false
						break;
					case 'taobao':
						this.tbShow = false
						break;
				}
			},
			getTime(val) {
				this.params = {
					...this.params,
					...dateFormat(val)
				}
			},
			chDate(index) {
				this.curIndex = index
				this.getTime(index)
			}
		}
	};
</script>
<style lang="scss" scoped>
	.box {
		width: 100vw;
		height: 100vh;
		overflow: hidden;
	}

	.auth {
		width: 750rpx;
		height: 100vh;
		background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.2) 100%);
		position: fixed;
		bottom: 0;
		left: 0;

		.btn {
			width: 342rpx;
			height: 72rpx;
			border-radius: 42rpx;
			background-color: $main-color;
			line-height: 72rpx;
			color: white;
			text-align: center;
			position: fixed;
			bottom: 110rpx;
			left: 0;
			right: 0;
			margin: 0 auto;
			font-size: 28rpx;
		}
	}

	.container {
		background-color: white;
		padding: 0 24rpx;

		.date {
			padding-top: 24rpx;
			padding-bottom: 24rpx;

			.li {
				font-szie: 20rpx;
				width: 128rpx;
				height: 48rpx;
				border-radius: 180rpx;
				background-color: #FFECE5;
				color: $main-color;
				text-align: center;
				line-height: 48rpx;
			}

			.li-c {
				background-color: $main-color;
				color: white;
			}
		}

		.panel {
			width: 702rpx;
			height: 404rpx;
			border-radius: 8rpx;
			padding: 30rpx 40rpx 40rpx 40rpx;
			font-size: 20rpx;
			color: white;
			overflow: hidden;
			background-color: $main-color;

			.sales {
				.price {
					font-size: 48rpx;
					font-weight: bold;
				}

				.rig {
					width: 128rpx;
					height: 48rpx;
					border-radius: 24rpx;
					font-size: 20rpx;
					background-color: white;
					line-height: 48rpx;
					color: $main-color;
				}
			}

			.ul {
				margin-top: 52rpx;

				.li {
					view {
						font-size: 20rpx;
					}

					.price {
						font-size: 36rpx;
						font-weight: bold;
					}
				}

				.bom {
					margin-top: 34rpx;
				}
			}
		}

		.filter {
			padding: 50rpx 24rpx 16rpx 24rpx;
			background-color: white;

			.icon {
				width: 24rpx;
				height: 24rpx;
				transition: all 0.5s;
			}
		}

		.ceil {
			position: fixed;
			top: 0;
			left: 0;
			width: 100%;
		}
	}

	.list .item:last-child {
		margin-bottom: 0;
	}

	.list {
		padding: 22rpx 24rpx;
		background-color: #FAFAFA;

		.item {
			background-color: white;
			padding: 20rpx;
			border-radius: 8rpx;
			margin-bottom: 24rpx;

			.top {
				align-items: flex-start;

				image {
					width: 96rpx;
					height: 96rpx;
				}

				.rig {
					flex: 1;
					padding-left: 12rpx;

					.time {
						margin-top: 10rpx;

						text {
							font-size: 20rpx;
							color: #0098FE;
						}

						view {
							font-size: 20rpx;
							color: #999999;
						}
					}
				}
			}

			.cen {
				padding: 22rpx 14rpx 26rpx 28rpx;
				border-bottom: 2rpx solid #F5F5F5;

				.li {
					text-align: center;
					font-size: 20rpx;
					color: #999999;

					view {
						margin-top: 4rpx;
						color: #333333;
					}
				}
			}

			.bom {
				padding: 18rpx 0 6rpx 0;

				image {
					width: 40rpx;
					height: 40rpx;
					border-radius: 50%;
					vertical-align: middle;
					margin-right: 16rpx;
				}

				text,
				.user {
					color: #707070;
				}
			}
		}
	}
</style>
